package com.wx.dao;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.wx.entity.SysWebArticle;
import com.wx.model.article.ArticleSummaryRecordModel;
import com.wx.model.article.SiteModel;

public interface SysWebArticleDao {
	@Select("SELECT p1.id,p1.name FROM sys_web_site AS p1")
	List<SiteModel> getSiteModel();
	
	@Select("SELECT p1.id,p1.name,p1.site_id,p1.litpic,p1.publish,p1.summary "
			+ "FROM sys_web_article AS p1 "
			+ "WHERE p1.site_id = #{sitenId,jdbcType=BIGINT} "
			+ "ORDER BY p1.id DESC, p1.publish DESC, p1.`order` DESC LIMIT #{startRows,jdbcType=INTEGER},#{pernum,jdbcType=INTEGER}")
	List<ArticleSummaryRecordModel> getArticleSummary( @Param("sitenId")Long sitenId,  @Param("startRows") Integer start, @Param("pernum") Integer pernum);

	@Select("SELECT p1.* "
			+ "FROM sys_web_article AS p1 "
			+ "WHERE p1.site_id = #{sitenId,jdbcType=BIGINT} "
			+ "ORDER BY p1.id DESC, p1.publish DESC, p1.`order` DESC LIMIT 1")
	SysWebArticle getArticleFT( @Param("sitenId")Long sitenId);
	@Select("SELECT p1.* "
			+ "FROM sys_web_article AS p1 "
			+ "ORDER BY p1.publish DESC  LIMIT 0,1")
	List<SysWebArticle> list();

}